/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aal.model;

import com.aal.business.OrderManagementLocal;
import com.aal.entity.OrderDetail;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author quy
 */
public class OrderDetailManagement {
    OrderManagementLocal orderManagement = lookupOrderManagementLocal();
    private long orderId;
    private int productId;
    private int quantity;
    private double totalnetprice;
    private double shippingcost;
    private double taxcost;

    public long getOrderId() {
        return orderId;
    }

    public void setOrderId(long orderId) {
        this.orderId = orderId;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getShippingcost() {
        return shippingcost;
    }

    public void setShippingcost(double shippingcost) {
        this.shippingcost = shippingcost;
    }

    public double getTaxcost() {
        return taxcost;
    }

    public void setTaxcost(double taxcost) {
        this.taxcost = taxcost;
    }

    public double getTotalnetprice() {
        return totalnetprice;
    }

    public void setTotalnetprice(double totalnetprice) {
        this.totalnetprice = totalnetprice;
    }
    public List<OrderDetail> getViewOrderDetail(){
       return orderManagement.viewOrderDetail(orderId);
    }
    public List<OrderDetail> getViewAllOrderDetail(){
       return orderManagement.viewAllOrderDetail();
    }
    private OrderManagementLocal lookupOrderManagementLocal() {
        try {
            Context c = new InitialContext();
            return (OrderManagementLocal) c.lookup("java:global/AAL/AAL-ejb/OrderManagement!com.aal.business.OrderManagementLocal");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
    
}
